package router

import (
	"ferry/apis/goods"
	"ferry/pkg/jwtauth"
	"github.com/gin-gonic/gin"
)

// RegisterGoodsRouter 注册商品路由
func RegisterGoodsRouter(v1 *gin.RouterGroup, authMiddleware *jwtauth.GinJWTMiddleware) {
	goodsRouter := v1.Group("/goods").Use(authMiddleware.MiddlewareFunc())
	{
		// 商品管理接口
		goodsRouter.GET("", goods.GetGoodsList)     // 获取商品列表
		goodsRouter.GET("/:id", goods.GetGoods)    // 获取商品详情
		goodsRouter.POST("", goods.CreateGoods)    // 创建商品
		goodsRouter.PUT("/:id", goods.UpdateGoods) // 更新商品
		goodsRouter.DELETE("/:id", goods.DeleteGoods) // 删除商品
	}
}